package com.mall.product.server.controller;

import com.mall.common.core.domain.Result;
import com.mall.product.server.service.DetailsService;
import com.mall.product.server.vo.ItemInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("/details")
public class DetailsController {


    @Autowired
    private DetailsService detailsService;


    /**
     * 查询商品详情页
     * @param skuId
     * @return
     */
    @GetMapping("/getDetails/{skuId}")
    public Result<ItemInfoVo> getDetailsBySkuId(@PathVariable Long skuId) throws ExecutionException, InterruptedException {
        return detailsService.getDetailsBySkuId(skuId);
    }

}
